import { getFollowUserList, setFollow } from "@/static/js/my.js";
export default {
  data() {
    return {
      loadingState: false, //关注是否加载成功
      gzList: [],
      page: 1,
      sort: "",
    };
  },
  onLoad() {
    this.getFollowUserList();
  },
  onShow() { },
  methods: {
    async getFollowUserList() {
      var params = {
        page: this.page,
        sort: this.sort,
      };
      let { code, data, msg } = await getFollowUserList(params);
      if (code == 1) {
        this.gzList = data.list;
      }
    },
    async gzFun(item) {
      let params = {
        uid: item.id,
      };
      let res = await setFollow(params);
      if (res.code == 1) {
        this.$tools.msg("取消关注");
        this.getFollowUserList();
      } else {
        this.$tools.msg(res.msg);
      }
    },
    toHome(item) {
      if (item.is_major == 1) {
        uni.navigateTo({
          url: "/pages/my/homeCenter/taTeacherHome?id=" + item.id,
        });
      } else {
        uni.navigateTo({
          url: "/pages/my/homeCenter/taHome?id=" + item.id,
        });
      }
    },
  },
};